import {BasicColumn} from '/@/components/Table';
import {FormSchema} from '/@/components/Table';
import { rules} from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
//列表数据
export const columns: BasicColumn[] = [
   {
    title: '部门',
    align:"center",
    dataIndex: 'deptId_dictText'
   },
   {
    title: '人员',
    align:"center",
    dataIndex: 'personId_dictText'
   },
   {
    title: '人员分组',
    align:"center",
    dataIndex: 'groupId_dictText'
   },
   {
    title: '考勤日期',
    align:"center",
    dataIndex: 'attDate',
    customRender:({text}) =>{
      return !text?"":(text.length>10?text.substr(0,10):text)
    },
   },
   {
    title: '考勤规则',
    align:"center",
    dataIndex: 'ruleId_dictText'
   },
   {
    title: '异常项',
    align:"center",
    dataIndex: 'exceptionTypes_dictText'
   },
   {
    title: '核实状态',
    align:"center",
    dataIndex: 'status_dictText'
   },
   {
    title: '核实人',
    align:"center",
    dataIndex: 'checkBy_dictText'
   },
   {
    title: '核实时间',
    align:"center",
    dataIndex: 'checkTime'
   },
   {
    title: '核实结果',
    align:"center",
    dataIndex: 'cehckResult_dictText'
   },
   {
    title: '请假详情',
    align:"center",
    dataIndex: 'leaveDetail'
   },
];
//查询数据
export const searchFormSchema: FormSchema[] = [
	{
      label: "部门",
      field: 'deptId',
      component: 'JSelectDept',
      //colProps: {span: 6},
 	},
     {
      label: "考勤日期",
      field: "attDate",
      component: 'RangePicker',
      componentProps: {
          valueType: 'Date',
      },
      //colProps: {span: 6},
	},
	{
      label: "异常项",
      field: 'exceptionTypes',
      component: 'JDictSelectTag',
      componentProps:{
          dictCode:"exception_types"
      },
      //colProps: {span: 6},
 	},
	{
      label: "核实状态",
      field: 'status',
      component: 'JDictSelectTag',
      componentProps:{
          dictCode:"exception_check_status"
      },
      //colProps: {span: 6},
 	},
	{
      label: "核实结果",
      field: 'cehckResult',
      component: 'JDictSelectTag',
      componentProps:{
          dictCode:"exception_check_result"
      },
      //colProps: {span: 6},
 	},
];
//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '部门',
    field: 'deptId',
     component: 'JSelectDept',
  },
  {
    label: '人员',
    field: 'personId',
    component: 'JDictSelectTag',
    componentProps:{
        dictCode:"ss_person,name,id"
     },
  },
  {
    label: '人员分组',
    field: 'groupId',
    component: 'JDictSelectTag',
    componentProps:{
        dictCode:"ac_group,group_name,id"
     },
  },
  {
    label: '考勤日期',
    field: 'attDate',
    component: 'DatePicker',
  },
  {
    label: '考勤规则',
    field: 'ruleId',
    component: 'JDictSelectTag',
    componentProps:{
        dictCode:"dorm_att_rule,rule_name,id"
     },
  },
  {
    label: '异常项',
    field: 'exceptionTypes',
    component: 'JCheckbox',
    componentProps:{
        dictCode:"exception_types"
     },
  },
  {
    label: '核实状态',
    field: 'status',
    component: 'JCheckbox',
    componentProps:{
        dictCode:"exception_check_status"
     },
  },
  {
    label: '核实结果',
    field: 'status',
    component: 'cehckResult',
    componentProps:{
        dictCode:"exception_check_result"
     },
  },
  {
    label: '核实人',
    field: 'status',
    component: 'checkBy',
    componentProps:{
        dictCode:"sys_user,realname,id"
     },
  },
  {
    label: '请假详情',
    field: 'leaveDetail',
    component: 'Input',
  },
	// TODO 主键隐藏字段，目前写死为ID
	{
	  label: '',
	  field: 'id',
	  component: 'Input',
	  show: false
	},
];

// 高级查询数据
export const superQuerySchema = {
  deptId: {title: '部门',order: 0,view: 'sel_depart', type: 'string',},
  personId: {title: '人员ID',order: 1,view: 'list', type: 'string',dictTable: 'ss_person', dictCode: 'id', dictText: 'name',},
  groupId: {title: '人员分组ID',order: 2,view: 'number', type: 'number',dictTable: 'ac_group', dictCode: 'id', dictText: 'group_name',},
  attDate: {title: '考勤日期',order: 3,view: 'date', type: 'string',},
  ruleId: {title: '考勤规则ID',order: 4,view: 'number', type: 'number',dictTable: 'dorm_att_rule', dictCode: 'id', dictText: 'rule_name',},
  exceptionTypes: {title: '异常项',order: 5,view: 'checkbox', type: 'string',dictCode: 'exception_types',},
  leaveDetail: {title: '请假详情',order: 6,view: 'text', type: 'string',},
};

/**
* 流程表单调用这个方法获取formSchema
* @param param
*/
export function getBpmFormSchema(_formData): FormSchema[]{
  // 默认和原始表单保持一致 如果流程中配置了权限数据，这里需要单独处理formSchema
  return formSchema;
}